package playGround;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

import playGround.border.Border;
import playGround.border.Door;
import playGround.border.Wall;
import playGround.dungeon.CompositeDungeon;
import playGround.dungeon.Direction;
import playGround.dungeon.Level;
import playGround.dungeon.Position;
import playGround.dungeon.Shaft;
import playGround.square.OrdinarySquare;
import playGround.square.Rock;
import playGround.square.Scale;
import playGround.square.Square;
import playGround.square.TeleportationSquare;
import playGround.square.TransparentSquare;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Position positionCompMax = new Position(10,10,10);
		CompositeDungeon<Square> baseDungeon = new CompositeDungeon<Square>(positionCompMax);
		Position positionLevelMax = new Position(3,3,0);
		Level<Square> level = new Level<Square>(positionLevelMax);
		Position positionShaft = new Position(1,0,1);
		Position positionShaftMax = new Position(0,0,3);
		Shaft<Square> shaft = new Shaft<Square>(positionShaftMax);
		Position positionLevel = new Position(0,0,0);
		baseDungeon.addSubDungeon(level, positionLevel);
		baseDungeon.addSubDungeon(shaft, positionShaft);
		
		//De squares voor de shaft maken	
		Border wall1 = new Wall(false);
		Border wall2 = new Wall(false);
		Border wall3 = new Wall(false);
		Border wall4 = new Wall(false);
		Border wall5 = new Wall(false);
    	Border wall6 = new Wall(false);
		Border wall7 = new Wall(false);
		Border wall8 = new Wall(false);
		Border door1 = new Door();
		Map<Direction, Border> bordersSquare1 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare2 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare3 = new HashMap<Direction, Border>();
		bordersSquare1.put(Direction.NORTH,wall1);
		bordersSquare1.put(Direction.FLOOR,wall3);
		bordersSquare1.put(Direction.EAST,wall4);
		bordersSquare2.put(Direction.NORTH,wall2);
		bordersSquare2.put(Direction.WEST,wall5);
		bordersSquare2.put(Direction.SOUTH, wall6);
		bordersSquare3.put(Direction.WEST, wall7);
		bordersSquare3.put(Direction.SOUTH, wall8);
		bordersSquare3.put(Direction.EAST, door1);
		Square square1 = new OrdinarySquare(100,new BigDecimal(50),Scale.CELCIUS,bordersSquare1);
		Square square2= new OrdinarySquare(90,new BigDecimal(25),Scale.CELCIUS,bordersSquare2);
		Square square3= new OrdinarySquare(100,new BigDecimal(50),Scale.CELCIUS,bordersSquare3);
		
		// squares van de shaft toevoegen
		Position position1 = new Position(0,0,1);
		Position position3 = new Position(0,0,2);
		Position position2 = new Position(0,0,3);
		shaft.addSquare(position1, square1);
		shaft.addSquare(position2, square2);
		shaft.addSquare(position3, square3);
		
		//de squares van de level maken
		Border wall11 = new Wall(false);
		Border wall12 = new Wall(false);
		Border wall13 = new Wall(false);
		Border wall14 = new Wall(false);
		Border wall15 = new Wall(false);
		Border wall16 = new Wall(false);
		Border wall17 = new Wall(false);
		Border wall18 = new Wall(false);
		Border door2 = new Door();
		Map<Direction, Border> bordersSquare4 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare5 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare6 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare7 = new HashMap<Direction, Border>();
		Map<Direction, Border> bordersSquare8 = new HashMap<Direction, Border>();
		bordersSquare4.put(Direction.EAST, door2);
		bordersSquare5.put(Direction.WEST,wall12);
		bordersSquare6.put(Direction.SOUTH,wall13);
		bordersSquare6.put(Direction.WEST, wall14);
		bordersSquare6.put(Direction.EAST, wall15);
		bordersSquare7.put(Direction.SOUTH, wall16);
		bordersSquare7.put(Direction.EAST,wall11);
		bordersSquare8.put(Direction.EAST, wall17);
		bordersSquare8.put(Direction.NORTH, wall18);
		Square square4 = new TransparentSquare(100,new BigDecimal(50),Scale.CELCIUS,bordersSquare4);
		Square square5= new OrdinarySquare(90,new BigDecimal(25),Scale.CELCIUS,bordersSquare5);
		Square square6= new OrdinarySquare(100,new BigDecimal(50),Scale.CELCIUS,bordersSquare6);
		Square square7= new OrdinarySquare(-30,new BigDecimal(70),Scale.CELCIUS,bordersSquare7);
		Square square8= new OrdinarySquare(-30,new BigDecimal(50),Scale.CELCIUS,bordersSquare8);
		Position position4 = new Position(1,0,0);
		Position position5 = new Position(1,1,0);
		Position position6 = new Position(1,2,0);
		Position position7 = new Position(2,0,0);
		Position position8 = new Position(2,1,0);
		Position position9 = new Position(2,2,0);
		Position position10 = new Position(3,0,0);
		level.addSquare(position4, square4);
		level.addSquare(position5, square5);		
		level.addSquare(position6, square6);
		level.addSquare(position7, square7);
		level.addSquare(position8, square8);
		Rock rock1 = new Rock();
		Rock rock2 = new Rock();
		level.addSquare(position9, rock1);
		level.addSquare(position10, rock2);
		square4.getBorder(Direction.EAST).openOrClose();
		TeleportationSquare squareTel = (TeleportationSquare) square1;
		squareTel.addTeleportationDestination(square4);
		System.out.println(square1.canNavigateTo(square4));
		System.out.println(square1.canNavigateTo(square5));
		System.out.println(square1.canNavigateTo(square6));
		System.out.println(square1.canNavigateTo(square7));
		System.out.println(square1.canNavigateTo(square8));
		System.out.println("niet voor rock: "+square1.canNavigateTo(rock1));

	}

}
 